pkg_name=mutt
version=1.5.23
build_dir=$builds_dir_root/$pkg_name-$version
src_dir=$src_dir_root/$pkg_name-$version
url=https://bitbucket.org/$pkg_name/$pkg_name/downloads/$pkg_name-$version.tar.gz

cd "$src_dir_root"
rm -Rf "$pkg_name-$version"
tar zxf "$pkg_name-$version.tar.gz"

#need to fix tons of little issues
cd "$src_dir"
cp -f "$builders_dir_root/$pkg_name/configure.patch" ./
patch -Ni ./configure.patch
cp -f "$builders_dir_root/$pkg_name/Makefile.in.patch" ./
patch -Ni ./Makefile.in.patch

rm -Rf "$build_dir"
mkdir -p "$build_dir"
cd "$build_dir"

export CFLAGS=-O0
"$src_dir/configure"			\
	--prefix=			\
	--enable-largefile		\
	--disable-gpgme			\
	--disable-pgp			\
	--disable-smime			\
	--disable-external-dotlock	\
	--disable-pop			\
	--disable-imap			\
	--disable-smtp			\
	--disable-debug			\
	--disable-flock			\
	--enable-fcntl			\
	--enable-warnings		\
	--disable-nfs-fix		\
	--disable-mailtool		\
	--disable-locales-fix		\
	--enable-exact-address		\
	--disable-hcache		\
	--enable-iconv			\
	--enable-nls			\
	--disable-full-doc		\
	--with-regex			\
	--with-mailpath=/var/spool/mail	\
	--without-tokyocabinet		\
	--without-qdbm			\
	--without-gdbm			\
	--without-bdb			\
	--without-idn			\
	--with-curses=/			\
	--with-wc-funcs
unset CFLAGS

make

install_tmp_dir=/tmp/$pkg_name-$version
rm -Rf "$install_tmp_dir"
mkdir -p "$install_tmp_dir"
make install "DESTDIR=$install_tmp_dir"

#don't forgthe the mailpath /var/spool/mail
install_dirs "$builders_dir_root/$pkg_name/runtime.dirs"
install_files "$builders_dir_root/$pkg_name/runtime.files" "$install_tmp_dir"
elf_strip "$builders_dir_root/$pkg_name/elf-strip"

rm -Rf "$install_tmp_dir"
rm -Rf "$build_dir"
rm -Rf "$src_dir"
